const Editor = require('../../src/index');
const div = document.createElement('div');
document.body.appendChild(div);

describe('align test', () => {
  it('item align default', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
  it('item align true', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
  it('item align false', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      },
      align: {
        item: 'false'
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
  it('item align horizontal', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      },
      align: {
        item: 'horizontal'
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
  it('item align vertical', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      },
      align: {
        item: 'vertical'
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
  it('item grid true', () => {
    const page = new Editor.Flow({
      graph: {
        container: div,
        width: 500,
        height: 500
      },
      align: {
        grid: true
      }
    });
    const graph = page.getGraph();
    graph.node().style({
      fillOpacity: 1
    });
    page.add('node', {
      x: 50,
      y: 100
    });
    page.add('node', {
      x: 100,
      y: 100
    });
    page.destroy();
  });
});

